clear all;clc
%% the original conditions
%目标函数
f=@(x)exp(-x)+x^2;
%目标区间
a=0;
b=1;
Theta_error=0.15;%精度
%% execute FibonacciOpt Algorithm
[x_opt,f_opt,stepNum]=FibonacciOpt(f,a,b,Theta_error);

%% function figure
x=a:0.01:b;
y=exp(-x)+x.^2;
plot(x,y,'k')
hold on
plot(x_opt,f_opt,'r*')

fprintf('%d is the optimal point of the function and execute %d steps',x_opt,stepNum)